# -*- coding:utf-8 -*-
# Author:wencheng.zhao
add_dic = {
    "河北":{
        "沧州市" : ["盐山1","盐山2","盐山3"],
        "保定市" : ["宝宝1","宝宝2","宝宝3"],
        "石家庄" : ["试试1","试试2","试试3"]
    },
    "山东":{
        "德州" : ["得得1","得得2","得得3"],
        "济南" : ["挤挤1","挤挤2","挤挤3"],
        "菏泽" : ["呵呵1","呵呵2","呵呵3"]
    }
}
pro = add_dic.keys()                               #获取所有省
pro_list = list(pro)                               #将所有的省存入列表中 ['山东', '河北']
zhixing = 1                                        #用于标记是否展示一级菜单
while True:
    if zhixing == int(1):                          #默认展示一级菜单
        for i in pro:                              #读取省
            index_num = pro_list.index(i) + 1      #获取展示的编号（列表的inde+1）
            print(("%s.""%s")%(index_num,i))       #展示
            #index_num += 1
        select_num_pro = input("一级请选择省（数字）q:退出程序:")       #获取用户选择的数字
        if select_num_pro == "q":
            exit(0)
        else:
            select_num_pro = int(select_num_pro)
            city = add_dic[pro_list[select_num_pro - 1 ]].keys()       #获取城市
            city_list = list(city)                                     #将城市放入列表中
    else:
         pass
    for t in city:                                                 #获取所在市
        city_num = city_list.index(t) + 1                          #获取展示编号
        print(("    %s.""%s") % (city_num, t))                     #展示市
        city_num += 1

    select_num_city = input("二级请选择市（数字）,q:退出程序，b:返回上一级:")   #获取用户选择数字
    if select_num_city == "b":                                                  #用户输入b返回
        zhixing = 1
        continue
    elif select_num_city == "q":                                                #用户输入q退出
        exit(0)
    else:
        select_num_city = int(select_num_city)-1                                 #获取city在city列表中的索引
        vill_list = add_dic[pro_list[select_num_pro - 1]][city_list[select_num_city]]      #存放乡村的列表
        for v in vill_list:                                                                #获取乡村
            print("            %s"  %v)                                                     #展示
    select_num_vill = input("三级请选择q:退出程序，b:返回上一级,任意键返回主菜单:")
    if select_num_vill == "q":
        exit(0)
    elif select_num_vill == "b":
        zhixing = 2



























